package start.demo01.datatype.json.entity.builder;

import start.demo01.datatype.json.entity.OutputConfig;
import start.demo01.datatype.json.entity.editor.jsonEditor.*;
import start.demo01.datatype.json.interfaces.JSONEditor;
import start.demo01.datatype.json.pool.CacheMap;

public class JSONEditorFactory {

    public static JSONEditor get(String method, String args,OutputConfig outputConfig) {
        switch (method) {
            case "remove":
                return new JSONRemoveEditor(args);
            case "insert":
                return new JSONInsertEditor(args);
            case "reserve":
                return new JSONReserveEditor(args);
            case "get":
                return new JSONGetEditor(args);
            case "copy":
                return new JSONCopyEditor(args);
            case "timeFormat":
                return new TimeFormatEditor(args);
            case "underline":
                return new JSONUnderlineEditor(args);
            case "intoMysql":
                outputConfig.setMysql(true);
                return new JSONSQLEditor(args);
            case "intoES":
                outputConfig.setEs(true);
                return new JSONESEditor(args);
            case "intoKafka":
                outputConfig.setKafka(true);
                return new JSONKafkaEditor(args);
            case "intoSyslog":
                outputConfig.setSyslog(true);
                return new JSONSyslogEditor(args);
//            default:
//                throw new RuntimeException(method + "函数不支持");
        }
        return null;
    }
}
